//
//  OtherViewController.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/23.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "OtherViewController.h"

@interface OtherViewController ()<UITableViewDelegate,UITableViewDataSource>

{
    NSArray *classList;
    
    NSArray *classNameList;
    
}

@property (nonatomic ,strong) UITableView *table;

@end

@implementation OtherViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    self.navigationItem.title = @"其他页面引导";
    
    [self loadData];
    
    [self createView];
    
}

#pragma mark ----RequestData
-(void)loadData
{
    classList = @[@"百科",@"二维码",@"账号安全",@"圈子",@"我的圈子"];
    classNameList = @[@"DEWBKHomeViewController",@"DEWQR_CodeViewController",@"DEWCountSafeViewController",@"DEWCommunityViewController",@"DEWMyRingViewController"];
}

#pragma mark ----initView
-(void)createView
{
    [self.view addSubview:self.table];
    
    
}


#pragma mark ---tableDelegate && DataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return classList.count;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    
    cell.textLabel.text = classList[indexPath.section];
    
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    
    return cell;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10.0f;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001f;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
//    [self showHint:classList[indexPath.section]];
    
    BaseViewController *vc = [[NSClassFromString(classNameList[indexPath.section]) alloc]init];
    
    [self.navigationController pushViewController:vc animated:YES];
    
    
}

#pragma mark ---lazy

-(UITableView *)table
{
    if (!_table) {
        _table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, DEWScreenWidth, DEWScreenHeight-NAVH- TabBarHeight) style:UITableViewStyleGrouped];
        
        _table.delegate = self;
        
        _table.dataSource = self;
        
        _table.separatorStyle = UITableViewCellSeparatorStyleNone;
        
    }
    
    return _table;
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
